package com.qf.factory;

import java.io.InputStream;
import java.util.Properties;

public class BeanFactory {

    private Properties properties = new Properties();

    public BeanFactory() {
    }

    public BeanFactory(String bean) throws Exception {
        InputStream inputStream = BeanFactory.class.getResourceAsStream(bean);
        properties.load(inputStream);
    }

    public Object getBean(String beans) throws Exception {
        Object o = null;
        if (properties != null) {
            String property = properties.getProperty(beans);

            Class<?> aClass = Class.forName(property);
            o = aClass.newInstance();
            return o;
        }
        return o;
    }

}
